package com.njth.beans;

import javax.servlet.http.HttpServletRequest;

import com.njth.util.Config;

public class Category extends BaseBean{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1923233643004534906L;

	private String name;/* 产品名称 */

	private int categoryfuncid;/* 产品功能ID，用于产品功能的遍历 */

	private Categoryfunc categoryfunc;/* 产品类别功能参数 */

	private String categorypic;/* 产品功能图片展示 */
	
	private String picThumbnail;

	public Category() {

	}

	public Category(int id, String name, int categoryfuncid,
			String categorypic, Categoryfunc categoryfunc) {
		super.setId(id);
		this.categoryfuncid = categoryfuncid;
		this.name = name;
		this.categorypic = categorypic;
		this.categoryfunc = categoryfunc;
	}

	/*
	 * 以下为各自的SET和GET方法
	 */
	public int getCategoryfuncid() {
		return categoryfuncid;
	}

	public void setCategoryfuncid(int categoryfuncid) {
		this.categoryfuncid = categoryfuncid;
	}

	public String getCategorypic() {
		return categorypic;
	}

	public void setCategorypic(String categorypic) {
		this.categorypic = categorypic;
	}

	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Categoryfunc getCategoryfunc() {
		return categoryfunc;
	}

	public void setCategoryfunc(Categoryfunc categoryfunc) {
		this.categoryfunc = categoryfunc;
	}

	/**
	 * 获取图片缩略图
	 * @return
	 */
	public String getPicThumbnail() {
		return picThumbnail;
	}

	/**
	 * 设置图片缩略图
	 * @param picThumbnail
	 */
	public void setPicThumbnail(String picThumbnail) {
		this.picThumbnail = picThumbnail;
	}
	
	public String getPicUri(HttpServletRequest request){
		return request.getContextPath()+"/"+Config.getConfigProperty("uploadImagePath")+"/"+this.categorypic;
	}
	
	public String getThumbnailUri(HttpServletRequest request){
		if(this.picThumbnail==null)
			return request.getContextPath()+"/"+"com/njth/images/4page_pic1.jpg";
		return request.getContextPath()+"/"+Config.getConfigProperty("uploadImagePath")+"/"+this.picThumbnail;
	}

}
